package com.foodplus.www.presenter;

import com.foodplus.www.api.BaseSubscriber;
import com.foodplus.www.api.ExceptionHandle;
import com.foodplus.www.bean.basket.BasketBean;
import com.foodplus.www.model.impl.BasketModelImpl;
import com.foodplus.www.view.impl.BasketView;

import java.util.Map;

/**
 * Created by WangZhiChao on 2016/11/2.
 */

public class BasketPresenter {

    BasketView view;

    public BasketPresenter(BasketView view) {
        this.view = view;
    }

    public void getBasketGoods(Map<String, String> params) {
        new BasketModelImpl().getBasketData(params, new BaseSubscriber<BasketBean>() {
            @Override
            public void onSuccess(BasketBean basketBean) {
                view.onSuccess(basketBean);
            }

            @Override
            public void onFail(ExceptionHandle.ResponeThrowable e) {
                view.onFail(e);
            }

            @Override
            public void onFinished() {
                view.onFinish();
            }
        });
    }
}
